﻿using System;
using DosTexPrj.Core.Models;
using FluentNHibernate.Mapping;

namespace DosTexPrj.Implement.NHibernate.Mapping
{
    public class KnittingOrderDetailMapping : ClassMap<KnittingOrderDetail>
    {
        public KnittingOrderDetailMapping()
        {
            Table("KnittingOrderDetails");
            Id(x => x.Id, "KnittingOrderDetailID").UnsavedValue(Guid.Empty).GeneratedBy.Guid();
            Map(x => x.Weight).Not.Nullable();
            Map(x => x.Length).Not.Nullable();
            Map(x => x.Price).Not.Nullable();
            Map(x => x.Note).Not.Nullable().Length(500);
            References<Composition>(x => x.Composition).Column("CompostionID").Not.LazyLoad();
            References<KnittingOrder>(x => x.BelongToKnittingOrder).Column("KnittingOrderID").Not.LazyLoad();
        }
    }
}